package com.proj.hot.utils;

import android.os.Environment;

/**
 * Created by zangchenggang on 16/11/15.
 */
public class SDCardUtil {
    /**
     * 判断SDCard是否存在
     * @return
     */
    public static boolean ExistSDCard(){
        if(!Environment.getExternalStorageDirectory().equals(Environment.MEDIA_MOUNTED))
            return true;//SDCard存在
        else
            return false;//SDCard不存在
    }
    /**
     * 获取SDCard卡路径
     *
     * @return SDCard卡存在返回SDCard卡根目录，不存在返回null
     */
    public static String getSDCardPath() {
        String SDCardPath;
        if (Environment.getExternalStorageState().equals(
                Environment.MEDIA_MOUNTED))
            return SDCardPath = Environment.getExternalStorageDirectory()
                    .toString();// SD卡根目录
        else
            // SDCard卡不存在
            return null;
    }
}
